package com.yonyou.cyxdms.basedata.service.repository.model;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yonyou.cyx.framework.dao.base.SuperMapper;
import com.yonyou.cyxdms.basedata.client.domains.vo.ModelCacheVO;
import com.yonyou.cyxdms.basedata.service.entity.model.ModelPO;
import com.yonyou.cyxdms.basedata.service.vo.VsProductDlrVO;
import com.yonyou.cyxdms.basedata.service.vo.model.GmsModelVO;
import com.yonyou.cyxdms.basedata.service.vo.model.ModelDictVO;
import com.yonyou.cyxdms.basedata.service.vo.model.VehicleProductModelVO;
import com.yonyou.cyxdms.basedata.service.vo.packages.PackageDictVO;

import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 车型 Mapper 接口
 * </p>
 *
 * @author renwd
 * @since 2018-12-11
 */
public interface ModelMapper extends SuperMapper<ModelPO> {

    List<ModelCacheVO> queryModelByCondition(@Param("params") Map<String, Object> queryParam);

    /**
     * 根据车系id查询车型信息
     *
     * @param seriesId
     * @param appId
     * @param groupCode
     * @return java.util.List<com.yonyou.cyxdms.basedata.client.domains.DTO.basedata.ModelCacheVO>
     * @author guorp
     * @since 2018/12/13
     */
    List<ModelCacheVO> getModelBySeriesId(@Param("seriesId") Long seriesId, @Param("appId") String appId, @Param("groupCode") String groupCode);

    List<ModelCacheVO> allModel(@Param("ownerCode") String ownerCode, @Param("appId") String appId);

    /**
     * 查询车型信息（pc）
     *
     * @param queryParam
     * @return java.util.List<com.yonyou.cyxdms.basedata.service.vo.model.VehicleProductModelVO>
     * @author renwd
     * @since 2019/7/10
     */
    List<VehicleProductModelVO> queryVehicleProductModel(IPage page, @Param("params") Map<String, Object> queryParam);

    /**
     * 导出车型
     *
     * @param queryParam
     * @return java.util.List<java.util.Map>
     * @author renwd
     * @since 2019/7/15
     */
    List<Map> exportExcelForModel(@Param("params") Map<String, Object> queryParam);

    /**
     * 车型下拉框
     *
     * @param queryParam
     * @return java.util.List<com.yonyou.cyxdms.basedata.service.vo.model.ModelDictVO>
     * @author renwd
     * @since 2019/7/16
     */
    List<ModelDictVO> queryModelDict(@Param("params") Map<String, Object> queryParam);

    /**
     * dms端 查询集团端
     *
     * @param queryParam
     * @return java.util.List<com.yonyou.cyxdms.basedata.service.vo.model.GmsModelVO>
     * @author renwd
     * @since 2019/7/18
     */
    List<GmsModelVO> queryGmsModel(@Param("params") Map<String, Object> queryParam);

    /**
     * dcs按条件查询车型信息
     *
     * @param queryParam
     * @return java.util.List<com.yonyou.cyxdms.basedata.service.vo.model.GmsModelVO>
     * @author renwd
     * @since 2019/7/18
     */
    List<GmsModelVO> queryVehicleProductDcsModel(Page page, @Param("params") Map<String, Object> queryParam);

    /**
     * @Description: 有效车型下拉框
     * @Param: [seriesId, appId]
     * @Return: java.util.List<com.yonyou.cyxdms.basedata.service.vo.model.ModelDictVO>
     * @Author: lijun
     * @Date: 16:05 2019/8/22
     **/
    List<ModelDictVO> getModelDict(@Param("appId") String appId,
                                   @Param("seriesId") Long seriesId);

    /**
     * @Description: 根据Code获取车型
     * @Param: [seriesId, appId, modelCode]
     * @Return: com.yonyou.cyxdms.basedata.service.vo.model.ModelDictVO
     * @Author: lijun
     * @Date: 16:05 2019/8/22
     **/
    ModelDictVO getByCode(@Param("appId") String appId,
                          @Param("seriesId") Long seriesId,
                          @Param("modelCode") String modelCode);

    ModelDictVO getByCodeOnly(@Param("appId") String appId, @Param("modelCode") String modelCode);

    List<ModelPO> getModelByAppidAndName(@Param("appId") String appId,
                                         @Param("name") String name);

    List<Long> getIdListByCondition(@Param("modelName") String modelName);

    Map<String, Object> queryAllCode(@Param("modelId") Long modelId);

    List<ModelPO> selectModelByUpdateTime(@Param("appId") String appId, @Param("updateTime") LocalDateTime updateTime);

    ModelPO selectByModelCode(@Param("appId") String appId, @Param("modelCode") String modelCode);

    /**
     * 品系型查询界面车型下拉框
     *
     * @param queryParam
     * @author Tansj
     * @since 2019/11/18
     */
    List<ModelDictVO> queryModelDictAll(@Param("params") Map<String, Object> queryParam);

    /**
     * 新增编辑界面本店面车型下拉框
     *
     * @param queryParam
     * @author Tansj
     * @since 2019/11/18
     */
    List<ModelDictVO> queryModelDictOwner(@Param("params") Map<String, Object> queryParam);
    
    /**
     * 新增编辑界面本店面配置下拉框
     *
     * @param queryParam
     * @author zhangys
     * @since 2020/2/25
     */
    List<PackageDictVO> queryPackageDictOwner(@Param("params") Map<String, Object> queryParam);

    /**
     * 新增编辑界面本店面车型下拉框
     *
     * @param queryParam
     * @author Tansj
     * @since 2019/11/18
     */
    List<ModelDictVO> queryDcsModelDictOwner(@Param("params") Map<String, Object> queryParam);

    /**
     * 查询车型信息（pc）
     *
     * @param queryParam
     * @return java.util.List<com.yonyou.cyxdms.basedata.service.vo.model.VehicleProductModelVO>
     * @author Caozx
     * @since 2020/11/24
     */
    List<VehicleProductModelVO> queryVehicleProductModel(@Param("params") Map<String, Object> queryParam);

    VsProductDlrVO getModelNew(@Param("modelCode")String modelCode,@Param("appId")String appId);

    ArrayList<ModelDictVO> queryModelDictAllNoPar();

}
